<template>
  <div class="page">
    <Head></Head>
    <h1>{{ msg }}</h1>
    <router-link to="/HelloWorld/page1/page4/page5">Go to page4</router-link>
    <transition :name='transitionName'>
      <router-view  class='child-view'></router-view>
    </transition>
  </div>
</template>

<script>
import Head from './head'
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'page4',
      transitionName: 'vux-pop-in'
    }
  },
  components: {
    Head,
  },
  watch: {
    $route(to,from){
        console.log(2,to.name,from.name)
        const toDepth = to.path.split('/').length
        const fromDepth = from.path.split('/').length
        if (toDepth === fromDepth) {
            console.log(190)
            return false;
        }
        this.transitionName = toDepth < fromDepth ? 'slide-right' : 'slide-left'
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.page {
  position: absolute;;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
      z-index: 999;
}
</style>